using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Sys_Api - 外部接口 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class ISysApi<T> :ModelBase<SysApi> where T : SysApi, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.WebId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return WebId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.WebId=dy.WebId;
           this.Title=dy.Title;
           this.Explain=dy.Explain;
           this.WebLink=dy.WebLink;
           this.ImgUlr=dy.ImgUlr;
           this.SsoUrl=dy.SsoUrl;
           this.SsoDomain=dy.SsoDomain;
           this.AddTime=dy.AddTime;
           this.Status=dy.Status;
           this.UserId=dy.UserId;
           this.OpenType=dy.OpenType;
           this.IsUserList=dy.IsUserList;
           this.IsUserDetailed=dy.IsUserDetailed;
           this.IsCommunity=dy.IsCommunity;
           this.Sno=dy.Sno;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// ApiId
        /// </summary>
        private String _WebId = "";
      
        /// <summary>
        /// ApiId
        /// </summary>
        public String WebId
        {
            get 
            {
              return   (this._WebId); 
            }

            set 
            {
                    _WebId= value;  
            }
        }
       
     
         /// <summary>
        /// 名称
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 名称
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// 说明
        /// </summary>
        private String _Explain = "";
      
        /// <summary>
        /// 说明
        /// </summary>
        public String Explain
        {
            get 
            {
              return   (this._Explain); 
            }

            set 
            {
                    _Explain= value;  
            }
        }
       
     
         /// <summary>
        /// 开发商网站
        /// </summary>
        private String _WebLink = "";
      
        /// <summary>
        /// 开发商网站
        /// </summary>
        public String WebLink
        {
            get 
            {
              return   (this._WebLink); 
            }

            set 
            {
                    _WebLink= value;  
            }
        }
       
     
         /// <summary>
        /// 外部图片
        /// </summary>
        private String _ImgUlr = "";
      
        /// <summary>
        /// 外部图片
        /// </summary>
        public String ImgUlr
        {
            get 
            {
              return   (this._ImgUlr); 
            }

            set 
            {
                    _ImgUlr= value;  
            }
        }
       
     
         /// <summary>
        /// 单独登录地址
        /// </summary>
        private String _SsoUrl = "";
      
        /// <summary>
        /// 单独登录地址
        /// </summary>
        public String SsoUrl
        {
            get 
            {
              return   (this._SsoUrl); 
            }

            set 
            {
                    _SsoUrl= value;  
            }
        }
       
     
         /// <summary>
        /// 单点登录识别域名
        /// </summary>
        private String _SsoDomain = "";
      
        /// <summary>
        /// 单点登录识别域名
        /// </summary>
        public String SsoDomain
        {
            get 
            {
              return   (this._SsoDomain); 
            }

            set 
            {
                    _SsoDomain= value;  
            }
        }
       
     
         /// <summary>
        /// 添加时间
        /// </summary>
        private DateTime _AddTime =DateTime.MinValue;
      
        /// <summary>
        /// 添加时间
        /// </summary>
        public DateTime AddTime
        {
            get 
            {
              return   (this._AddTime); 
            }

            set 
            {
                    _AddTime= value;  
            }
        }
       
     
         /// <summary>
        /// 状态
        /// </summary>
        private int _Status =-1;
      
        /// <summary>
        /// 状态
        /// </summary>
        public yq.Enums.BooleanType Status
        {
            get 
            {
              return  (yq.Enums.BooleanType)_Status; 
            }

            set 
            {
                    _Status= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 添加人
        /// </summary>
        private String _UserId = "";
      
        /// <summary>
        /// 添加人
        /// </summary>
        public String UserId
        {
            get 
            {
              return   (this._UserId); 
            }

            set 
            {
                    _UserId= value;  
            }
        }
       
     
         /// <summary>
        /// 打开方式
        /// </summary>
        private int _OpenType =-1;
      
        /// <summary>
        /// 打开方式
        /// </summary>
        public yq.Enums.SysApi.OpenType OpenType
        {
            get 
            {
              return   (yq.Enums.SysApi.OpenType)this._OpenType;  
            }

            set 
            {
                    _OpenType= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否允许访问人员列表
        /// </summary>
        private int _IsUserList =-1;
      
        /// <summary>
        /// 是否允许访问人员列表
        /// </summary>
        public yq.Enums.BooleanType IsUserList
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsUserList; 
            }

            set 
            {
                    _IsUserList= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否允许读取人员详细信息
        /// </summary>
        private int _IsUserDetailed =-1;
      
        /// <summary>
        /// 是否允许读取人员详细信息
        /// </summary>
        public yq.Enums.BooleanType IsUserDetailed
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsUserDetailed; 
            }

            set 
            {
                    _IsUserDetailed= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否允许读取社区内容
        /// </summary>
        private int _IsCommunity =-1;
      
        /// <summary>
        /// 是否允许读取社区内容
        /// </summary>
        public yq.Enums.BooleanType IsCommunity
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsCommunity; 
            }

            set 
            {
                    _IsCommunity= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 排序
        /// </summary>
        private int _Sno =int.MinValue;
      
        /// <summary>
        /// 排序
        /// </summary>
        public int Sno
        {
            get 
            {
              return   (this._Sno); 
            }

            set 
            {
                    _Sno= value;  
            }
        }
       
     
        
       

      #endregion 定义属性 

          protected internal override void SetValue(SysApi info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["WebId"]!= DBNull.Value)
                  {
                  info.WebId=row["WebId"].ToString();
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["Explain"]!= DBNull.Value)
                  {
                  info.Explain=row["Explain"].ToString();
                 }
                 
                  
                  if(row["WebLink"]!= DBNull.Value)
                  {
                  info.WebLink=row["WebLink"].ToString();
                 }
                 
                  
                  if(row["ImgUlr"]!= DBNull.Value)
                  {
                  info.ImgUlr=row["ImgUlr"].ToString();
                 }
                 
                  
                  if(row["SsoUrl"]!= DBNull.Value)
                  {
                  info.SsoUrl=row["SsoUrl"].ToString();
                 }
                 
                  
                  if(row["SsoDomain"]!= DBNull.Value)
                  {
                  info.SsoDomain=row["SsoDomain"].ToString();
                 }
                 
                  
                  if(row["AddTime"]!= DBNull.Value)
                  {
                  info.AddTime=Convert.ToDateTime(row["AddTime"]);
                 }
                 
                  
                  if(row["Status"]!= DBNull.Value)
                  {
                  info.Status= (yq.Enums.BooleanType)(row["Status"]) ;
                 }
                 
                  
                  if(row["UserId"]!= DBNull.Value)
                  {
                  info.UserId=row["UserId"].ToString();
                 }
                 
                  
                  if(row["OpenType"]!= DBNull.Value)
                  {
                  info.OpenType=  (yq.Enums.SysApi.OpenType)(row["OpenType"]) ;
                 }
                 
                  
                  if(row["IsUserList"]!= DBNull.Value)
                  {
                  info.IsUserList= (yq.Enums.BooleanType)(row["IsUserList"]) ;
                 }
                 
                  
                  if(row["IsUserDetailed"]!= DBNull.Value)
                  {
                  info.IsUserDetailed= (yq.Enums.BooleanType)(row["IsUserDetailed"]) ;
                 }
                 
                  
                  if(row["IsCommunity"]!= DBNull.Value)
                  {
                  info.IsCommunity= (yq.Enums.BooleanType)(row["IsCommunity"]) ;
                 }
                 
                  
                  if(row["Sno"]!= DBNull.Value)
                  {
                  info.Sno=Convert.ToInt32(row["Sno"]);
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, SysApi info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@WebId", DbType.String,ParameterTool.GetObj( info._WebId )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@Explain", DbType.String,ParameterTool.GetObj( info._Explain )); 
            
             
                cn.AddInParameter(comm, "@WebLink", DbType.String,ParameterTool.GetObj( info._WebLink )); 
            
             
                cn.AddInParameter(comm, "@ImgUlr", DbType.String,ParameterTool.GetObj( info._ImgUlr )); 
            
             
                cn.AddInParameter(comm, "@SsoUrl", DbType.String,ParameterTool.GetObj( info._SsoUrl )); 
            
             
                cn.AddInParameter(comm, "@SsoDomain", DbType.String,ParameterTool.GetObj( info._SsoDomain )); 
            
             
                cn.AddInParameter(comm, "@AddTime", DbType.DateTime,ParameterTool.GetObj( info._AddTime )); 
            
             
                cn.AddInParameter(comm, "@Status", DbType.Int32,ParameterTool.GetObj( info._Status )); 
            
             
                cn.AddInParameter(comm, "@UserId", DbType.String,ParameterTool.GetObj( info._UserId )); 
            
             
                cn.AddInParameter(comm, "@OpenType", DbType.Int32,ParameterTool.GetObj( info._OpenType )); 
            
             
                cn.AddInParameter(comm, "@IsUserList", DbType.Int32,ParameterTool.GetObj( info._IsUserList )); 
            
             
                cn.AddInParameter(comm, "@IsUserDetailed", DbType.Int32,ParameterTool.GetObj( info._IsUserDetailed )); 
            
             
                cn.AddInParameter(comm, "@IsCommunity", DbType.Int32,ParameterTool.GetObj( info._IsCommunity )); 
            
             
                cn.AddInParameter(comm, "@Sno", DbType.Int32,ParameterTool.GetObj( info._Sno )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 